home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / doc / dynamic.doc < prev    next >
Text File  |  1994-02-13  |  3KB  |  78 lines

  1.  
  2.     DYNAMIC.DOC (c)Copyright 1990-1991, Matthew Dillon, All Rights Reserved
  3.  
  4. TABLE OF CONTENTS
  5.  
  6. dynamic.library/__dynamic
  7. dynamic.library/
  8.  
  9.  
  10. dynamic.library/__dynamic            dynamic.library/__dynamic
  11.  
  12.     DICE has compile-time support for dynamic.library through the use of
  13.     the __dynamic storage qualifier.  dynamic.library is a library that
  14.     dynamically links object modules run-time allowing programs to make
  15.     procedure calls to said modules or even reference variables exported by
  16.     said modules.
  17.  
  18.     The dynamic.library calls that DICE uses are:
  19.  
  20.     symPtr = GetHyperSymbol(const char *symbolName, tags...)
  21.     (void)   RelsHyperSymbol(void *symPtr, tags...)
  22.  
  23.     The __dynamic storage qualifier is used as follows:
  24.  
  25.     (1) extern __dynamic int x;
  26.     (2) extern __dynamic int fubar(int);
  27.     (3) __dynamic int x;
  28.     (4) __dynamic int fubar(int);
  29.  
  30.     No aggregate initialization of a __dynamic variable is allowed and no
  31.     aggregate initialization of variables using the address of a dynamic
  32.     variable is allowed.  In otherwords:
  33.  
  34.     int *y = &x;    /*  ILLEGAL */
  35.  
  36.     test()
  37.     {
  38.     y = &x;     /*  LEGAL   */
  39.     }
  40.  
  41.     The compiler will generate autoinit and autoexit code to regargs
  42.     functions in C.LIB which in turn will call the appropriate
  43.     dynamic.library functions.    The regargs functions in C.LIB are:
  44.  
  45.     ptr = _GetHyperFunc(func_name, func_type)
  46.     ptr = _GetHyperVar(var_name)
  47.     (void)_RelsHyperFunc(ptr)
  48.     (void)_RelsHyperVar(ptr)
  49.  
  50.     If you wish, you can provide your own regargs functions to overide the
  51.     c.lib ones to provide your own dynamic procedure/variable capability.
  52.     The _Get*() functions return a pointer to the data item in question
  53.     while the _Rels*() functions release the reference, allowing the data
  54.     item to be freed after all references go away (multiple tasks might
  55.     share a given data item or procedure)
  56.  
  57.                    OVERVIEW OF CAPABILITIES
  58.  
  59.     run-time loading of object modules as performed by dynamic.library is
  60.     an incredibly powerful tool.  A third party might define a module
  61.     to do a specific job, such as convert a ViewPort and BitMap to an
  62.     IFF file.  The third party then makes this object module available
  63.     to the world.  Any program wishing to use the module simply does
  64.     so, but WITHOUT actually linking it in to the program.
  65.  
  66.     This allows the third-party to upgrade his module at any time without
  67.     requiring a recompile, and allows other parties to duplicate the
  68.     functional interface and make compatible, possibly more powerful
  69.     modules available to individual users, again without requiring users
  70.     to get an update of the particular program that uses said module(s).
  71.  
  72.     dynamic variables have similar capabilities, especially in terms of
  73.     shared memory.  Here is a method to share a variable amoung several
  74.     programs not necessarily written by the same author.  There being
  75.     no real limits, an object module might contain a semaphore variable,
  76.     for example, to arbitrate access to certain other constructs.
  77.  
  78.